package com.luoc.spring.validateChain;

/**
 * @author luoc
 * @version 1.0
 * @date 2021/3/17 16:10
 * @since 1.0
 */
public abstract class ValidateChain {

    ValidateChain validateChain;

    /**
     * 校验
     */
    abstract String validate(Object obj) ;

    public ValidateChain setNextValidation(ValidateChain validation){
            this.validateChain = validation;
            return  validation;
    }

    public void validateMsg(Object obj){
//        if (obj instanceof String){
//               System.out.println(validate(obj));
//        }

        if (validateChain !=null){
             validateChain.validateMsg(obj);
        }


    }
}
